package com.yuhanginfo.modules.web.entity;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.hibernate.validator.constraints.Length;

import com.yuhanginfo.common.persistence.WebDataEntity;
import com.yuhanginfo.common.utils.StringUtils;

/**
 * 套餐详情Entity
 * @author lvls
 * @version 2017-11-15
 */
public class WebGoodsCombDetail extends WebDataEntity<WebGoodsCombDetail> {
	
	private static final long serialVersionUID = 1L;
	private String goodsCombId;		// 套餐id
	private String goodsName;		// 商品名称
	private String goodsCode;		// 商品编号
	private BigDecimal oldPrice;		// 原价
	private BigDecimal price;		// 售价
	private BigDecimal vipPrice;		// 会员售价
	private Integer num;
	private Integer isHistory;
	private String partsCode;
	private String goodsImage;
	private List<String> goodsImageList;
	
	private Integer goodsId;
	
	public WebGoodsCombDetail() {
		super();
	}

	public WebGoodsCombDetail(String id){
		super(id);
	}

	@Length(min=0, max=11, message="套餐id长度必须介于 0 和 11 之间")
	public String getGoodsCombId() {
		return goodsCombId;
	}

	public void setGoodsCombId(String goodsCombId) {
		this.goodsCombId = goodsCombId;
	}
	
	@Length(min=0, max=50, message="商品名称长度必须介于 0 和 50 之间")
	public String getGoodsName() {
		return goodsName;
	}

	public void setGoodsName(String goodsName) {
		this.goodsName = goodsName;
	}
	
	@Length(min=0, max=50, message="商品编号长度必须介于 0 和 50 之间")
	public String getGoodsCode() {
		return goodsCode;
	}

	public void setGoodsCode(String goodsCode) {
		this.goodsCode = goodsCode;
	}
	
	public BigDecimal getOldPrice() {
		return oldPrice;
	}

	public void setOldPrice(BigDecimal oldPrice) {
		this.oldPrice = oldPrice;
	}
	
	public BigDecimal getPrice() {
		return price;
	}

	public void setPrice(BigDecimal price) {
		this.price = price;
	}
	
	public BigDecimal getVipPrice() {
		return vipPrice;
	}

	public void setVipPrice(BigDecimal vipPrice) {
		this.vipPrice = vipPrice;
	}

	public Integer getNum() {
		return num;
	}

	public void setNum(Integer num) {
		this.num = num;
	}

	public String getPartsCode() {
		return partsCode;
	}

	public void setPartsCode(String partsCode) {
		this.partsCode = partsCode;
	}

	public Integer getGoodsId() {
		return goodsId;
	}

	public void setGoodsId(Integer goodsId) {
		this.goodsId = goodsId;
	}

	public String getGoodsImage() {
		return goodsImage;
	}

	public void setGoodsImage(String goodsImage) {
		this.goodsImage = goodsImage;
	}

	public Integer getIsHistory() {
		return isHistory;
	}

	public void setIsHistory(Integer isHistory) {
		this.isHistory = isHistory;
	}

	public List<String> getGoodsImageList() {
		if(StringUtils.isNotBlank(goodsImage)) {
			String im=goodsImage.split(";")[0];
			return Arrays.asList(im);
		}else {
			this.goodsImageList = new ArrayList<String>();
			return goodsImageList;
		}
	}

	public void setGoodsImageList(List<String> goodsImageList) {
		this.goodsImageList = goodsImageList;
	}
	
}